/**
 * *************************************
 * Copyright(c)2016 Dingdang Yixia 
 * All Rights Reserved.
 *
 * @File: AndroidLoginController.java
 * @Package: com.ddyx.rest
 * @Description:
 * 
 * @Version: V1.0
 * @Author: Yidong.Xiang
 * @Date: 2017年11月29日 下午6:18:26
 * 
 * *************************************
 */
package com.ddyx.rest;

import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ddyx.service.IUserAccessService;
import com.ddyx.service.IUserService;
import com.ddyx.util.RequestForm;
import com.ddyx.util.ResponseForm;

/**
 * @ClassName: AndroidLoginController.java
 * @Module: 安卓端用户登录请求控制器模块
 * @Description: 接收安卓端用户登录请求
 * 
 * @author: Yidong.Xiang
 * @date: 2017年11月29日 下午6:18:26
 * 
 */
@Controller
@RequestMapping("/andrapp")
public class AndroidLoginController {

	@Resource
	private HttpServletRequest request;
	@Resource 
	IUserAccessService userAccessService;
	@Resource
	IUserService iUserService;
	/**
	 * 使用店手机号登录请求
	 * @param requestForm
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/login", method = RequestMethod.POST)
	public ResponseForm login(@RequestBody RequestForm requestForm) {
		return userAccessService.wechatUserlogin(requestForm);
	}
	
	/**
	 * 使用手机号获取叮店用户Id
	 * @param requestForm
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/getWxUid", method = RequestMethod.POST)
	public ResponseForm getWxUid(@RequestBody RequestForm requestForm) {
		return userAccessService.getWxUid(requestForm);
	}	
	/**
	 * 微信用户会话状态验证
	 * @param requestForm
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/checkSession", method = RequestMethod.POST)
	public ResponseForm checkSession(@RequestBody RequestForm requestForm) {
		
		return null;
	}
	
	/**
	 * @desciption 获取店员的信息 (来自ddyxvip项目的请求,获取wxUid,wxSid,和storeNo)
	 * @param requestForm
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "getEmployInfo",method = RequestMethod.GET)
	public Map<String, Object> getEmployInfoFromAndroid(@Param(value = "mobile") String mobile) {
		return iUserService.getEmployInfo(mobile);
	}
}
